feat(incremental): delta-aware index + enrich (skip-by-hash + manifest short-circuit)#174
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
codeiq indexskips parse+detect for files whose content hash already lives in the cache (~5-10× faster on unchanged trees).codeiq enrichshort-circuits when the cache manifest hash matches what the graph stored on its last run (86 ms vs 582 ms full rebuild onfixture-multi-lang).enrichis now safely re-runnable: a newStore.Reset()drops prior CodeNode+GraphMeta data before a full rebuild, so re-runs no longer collide on primary keys.codeiq diffsubcommand previews the cache vs disk delta as JSON without touching anything;index --forceandenrich --force/--diffflags surface the new behaviour.sourcetag so future delta-apply work can wipe + re-emit them en bloc viaStore.WipeLinkerEdges.What's not in this PR (deferred)
ReplaceFileper changed path instead of full rebuild). The primitives ship here —Store.RemoveFile / InsertFile / ReplaceFileare wired and tested — but the enrich orchestrator still does a full rebuild when the manifest mismatches. The short-circuit case (the common one) is fully delta-aware.Phases (12 atomic commits)
feat(cache)GetFileByPath,AllFiles,PurgeByPath,ManifestHashfeat(analyzer): DiffDelta{Added,Modified,Deleted,Unchanged}feat(analyzer): cache-hit early-exitOptions.Force+ newStatscountersfeat(graph): RemoveFile/InsertFile/ReplaceFilefeat(graph): GraphMeta + manifestReadManifest/WriteManifestfeat(linker+graph): source-tag + WipeLinkerEdgesfeat(enrich): manifest short-circuit + Resetfeat(cli)index --force,enrich --force/--diff,codeiq difftest(integration)Test plan
CGO_ENABLED=1 go test ./... -count=1— 937 passing across 44 packagesCGO_ENABLED=1 go test ./internal/analyzer/ ./internal/graph/ ./internal/cache/ -race -count=1— 143 passing, no data racesgo vet ./...— cleantestdata/fixture-minimal:codeiq index .: 5 files Added, 0 cache hitscodeiq index .: 5 Unchanged, 100% cache hitscodeiq enrich .: "enrich short-circuited: graph already matches cache manifest"codeiq enrich --force .: rebuilds cleanly without PK collisionscodeiq diff .: returns JSON with empty Added/Modified/Deleted and 5 UnchangedKnown follow-up (out of scope)
govulncheckflags 2 stdlibnet/httpCVEs (go1.26.2 → fix in 1.26.3) — toolchain bump, separate work.